<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>邀请记录</title>
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <link rel="stylesheet" href="../css/aui.2.0.css">
    <link rel="stylesheet" href="../css/reset.css">
    <link rel="stylesheet" href="../css/alert.css">
    <link rel="stylesheet" href="../css/common1.css">
    <link rel="stylesheet" href="../css/common.css">
    <link rel="stylesheet" href="../css/lessstyle.css">
</head>
<body>
<header class="aui-bar aui-bar-nav" id="aui-header">
    <div class="aui-col-xs-3 my-col-xs-3">
        <i class="aui-iconfont aui-icon-left"></i>
    </div>
    <div class="aui-title my-aui-title">邀请记录</div>
</header>
<nav>
    <div class="member-info-entry">
        <script type="text/x-handlebars-template" id="teamadmin-template">
            <ul class="member-info-list teamadmin-info-list">
                <li>
                    <a href="javascript:;" class="display-box">
                        <span>团队邀请码</span>
                        <span class="copy">复制</span>
                        <span class="code">{{groupCode}}</span>
                    </a>
                </li>
                <li>
                    <a href="myteam.html" class="display-box">
                        <span>我的团队</span>
                        <span>{{groupCount}}</span>
                    </a>
                </li>
            </ul>
        </script>
    </div>
</nav>
<script src="../js/jquery-3.0.0.min.js"></script>
<script src="../js/handlebars-v4.0.10.js"></script>
<script src="../js/config.js"></script>
<script src="../js/common.js"></script>
<script src="../js/function.js"></script>
<script src="../js/alert.js"></script>
<script>
    var a=$('#teamadmin-template').html();
    var b=Handlebars.compile(a);
    //alert(C.marketToken);
    $.ajax({
        url:C.marketInterface.teamadmin,
        type:'post',
        data:{
            token:C.marketToken
        },
        datatype:'json',
        success:function (data) {
//            console.log(data)
            if(data.result=='success'){
                var data=data.data;
                $('.member-info-entry').html(b(data));
//                点击复制
                $('.copy').bind('click',copyinityCode);

            }else if(data.result=='login'){
            	dialog.tusiError('登入过期，请重新登入！');
                againLogin();
            }else {
            	dialog.tusiError(data.errorMsg);
            }
        },
        error:function () {
            //alert('服务器异常');
        }
    });

    function copyinityCode() {
        var copyCode =$('.code').text();
        console.log(copyCode);
        var copyData={
            copyCode:copyCode
        };
        var ua = navigator.userAgent.toLowerCase();
        if (/iphone|ipad|ipod/.test(ua)) {
            iosCopyCode(copyData);
        } else {
            androidCopyCode(copyCode);
        }
    }


    function androidCopyCode(data) {
        window.huifa.funCopyCode(data);
    }

    function iosCopyCode(data) {
        window.webkit.messageHandlers.funCopyCode.postMessage(data);
    }
</script>
</body>
</html>